﻿//-----------------------------------------------------------------------
// <copyright file="IClientSessionRepository.cs" company="FastNET Services">
//     Copyright (c) 2008-2009. All Rights Reserved.
// </copyright>
// <license>
//     GPLv2
// </license>
// <warranty>
//     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
//     BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
//     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
//     DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// </warranty>
//-----------------------------------------------------------------------
#region Usings

using System;
using System.Collections.Generic;
using GateShift.Common.Repository.Interfaces.DataInterfaces.System;
using GateShift.Common.Repository.Interfaces.Repositories.Base;

#endregion

namespace GateShift.Common.Repository.Interfaces.Repositories.System
{
    /// <summary>
    /// Repository interface for IClientSessionData based data
    /// </summary>
    public interface IClientSessionRepository : IIdentityRepository<IClientSessionData>
    {
        /// <summary>
        /// Clears all sessions from the database
        /// </summary>
        /// <returns>Boolean whether or not the clearing of all sessions was successful</returns>
        bool ClearSessions();

        /// <summary>
        /// Clears all sessions from the database for a specific server
        /// </summary>
        /// <param name="ServerID">ID of the server hosting the session</param>
        /// <returns>Boolean whether or not the clearing of all sessions was successful</returns>
        bool ClearSessions(Guid ServerID);

        /// <summary>
        /// Retrieves all sessions from the database that have expired
        /// </summary>
        /// <returns>IList of IClientSessionData of all matching sessions</returns>
        IList<IClientSessionData> RetrieveExpiredSessions();

        /// <summary>
        /// Retrieves all sessions from the database that have expired for a specific server
        /// </summary>
        /// <param name="ServerID">ID of the server hosting the session</param>
        /// <returns>IList of IClientSessionData of all matching sessions</returns>
        IList<IClientSessionData> RetrieveExpiredSessions(Guid ServerID);

        /// <summary>
        /// Expires a specific session from the database
        /// </summary>
        /// <param name="SessionID">ID of the session to expire</param>
        /// <returns>Boolean whether or not expiring of the session was successful</returns>
        /// <exception cref="ArgumentNullException">Thrown is SessionID is null</exception>
        bool ExpireSession(Identity SessionID);
    }
}